﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Windows.Controls;
using Bixas.Tangibilis.Controls.Primitives;

namespace Bixas.Tangibilis.Controls
{
    internal class TouchCheckBoxAdapter : TouchButtonBaseAdapter<TouchCheckBox>
    {

        public TouchCheckBoxAdapter(TouchCheckBox element)
            : base(element)
    {
    }
        protected override void OnTouchClick(RawTouchCursorInputEventArgs e)
        {
            this.OnTouchToggle(e);
            base.OnTouchClick(e);
            
        }

        protected virtual void OnTouchToggle(RawTouchCursorInputEventArgs args)
        {
            CheckBox element = (CheckBox)TouchElement;

            //set the isChecked Property of the base CheckBox
            if (element.IsChecked == true)
            {
                element.IsChecked = element.IsThreeState ? null : ((bool?)false);
            }
            else
            {
                element.IsChecked = new bool?(element.IsChecked.HasValue);
            }

            //Raise appropriate events depending on the state of the checkbox
            if (element.IsChecked == true)
            {
                //this.OnMultiPointChecked(args);
            }
            else if (element.IsChecked == false)
            {
                //this.OnMultiPointUnchecked(args);
            }
            else
            {
                //this.OnMultiPointIndeterminate(args);
            }

        }
    }
}
